package com.ljd.controller;

import com.ljd.entity.CrmBanner;
import com.ljd.page.PageResponse;
import com.ljd.service.CrmBannerService;
import com.ljd.util.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author ljd
 * @since 2021-12-28
 */
@RestController
@RequestMapping("/educms/bannerFront")
//@CrossOrigin
public class BannerFrontController {
    @Autowired
    CrmBannerService bannerService;
    @GetMapping("getBanners")
    public R getBanners(){
        List<CrmBanner> crmBanners = bannerService.getBanners();
        return R.ok().data("items",crmBanners);
    }
    @ApiOperation(value = "添加幻灯片")
    @PostMapping("save")
    public R save(@RequestBody CrmBanner banner){
       bannerService.saveBanner(banner);
       return R.ok();
    }
}
